<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			//json 代替xml
			//[]:集合
			//{}:单个对象
			//key:value表示一个属性
			//逗号分隔属性和对象
			//支持无限嵌套
			var ar={"name":"徐凯","age":{"lastyear":23,"now":22,"nextyear":21}};
			var j63=[
			{"name":"徐凯","age":21,address:"合肥市包河区",showSelf:function(){alert(this.name);}},
			{"name":"华伟成","age":23,address:"合肥肥东双桥",showSelf:function(){alert(this.name);}},
			{"name":"侯颖","age":23,address:"工大",showSelf:function(){alert(this.name);}},
			{"name":"姜玲","age":17,address:"合肥市包河区",showSelf:function(){alert(this.name);}}
					];
			// for(let stu of j63){
			// 	stu.showSelf();
			// 	alert(stu.age+","+stu.address);
			// }		
			//let java63={teacher:"老李",num:37,startDate:"2019-8-12",mates:j63};
			let java63={teacher:"老李",num:37,startDate:"2019-8-12",mates:[
			{"name":"徐凯",like:["唱歌","篮球","rap"],"age":21,address:{province:"安徽省",city:"合肥市",street:"包公街道"},showSelf:function(){alert(this.name);}},
			{"name":"华伟成","age":23,address:"合肥肥东双桥",showSelf:function(){alert(this.name);}},
			{"name":"侯颖","age":23,address:"工大",showSelf:function(){alert(this.name);}},
			{"name":"姜玲","age":17,address:"合肥市包河区",showSelf:function(){alert(this.name);}}
					]};
			//JSON.str
			alert(java63);		
			alert(JSON.stringify(java63));
			  for(let stu of java63.mates){
			  	stu.showSelf();
			  	alert(stu.age+","+stu.address);
			  }
		</script>
	</head>
	<body>
	</body>
</html>
